﻿<?xml version="1.0" encoding="utf-8" ?>
<DbDataRequest connection="$DBConnection$" type="$ForumDBType$" defaultFormatter="bizobj ApprovalSet(approvers)">
	<SqlStatement hasResults="true">
		SELECT S.id as approvalSetId
			,S.objectType
			,A.approverId AS approversId
			,A.setId as approversSetId
			,A.rank AS approversRank
			,U.userName approversUserName
		FROM ApprovalSet AS S LEFT JOIN
			ObjectTreeNodes AS T ON S.id = T.parentHostId INNER JOIN
			ApprovalSetApprovers AS A ON A.approvalSetId=S.id INNER JOIN
			Users AS U ON U.id = A.approverId
		WHERE (S.id=@id OR T.objectId=@id) AND S.objectType =@objectType 
		ORDER BY approversRank
	</SqlStatement>
	<Param name="id" dbName="id" type="UniqueIdentifier"/>
	<Param name="objectType" dbName="objectType" type="UnicodeVarChar" />
</DbDataRequest >
